package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.Product;
import com.spzx.product.api.fallback.ProductFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * @ClassName ProductFeignClient
 * @Author 波
 * @Date 2024/8/5 20:39
 */
@FeignClient(contextId = "productFeignClient", path = "/product", value = ServiceNameConstants.PRODUCT_SERVICE, fallbackFactory = ProductFeignClientFallbackFactory.class)
public interface ProductFeignClient {

    @GetMapping("getProduct/{pid}")
    public R<Product> selectProductById(@PathVariable("pid") Long pid,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
